package com.blog.controller;

import com.blog.constants.SystemConstants;
import com.blog.domain.ResponseResult;
import com.blog.domain.entity.Comment;
import com.blog.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/comment")
public class CommentController {

	@Autowired
	private CommentService commentService;

	@GetMapping("/commentList")
	public ResponseResult commentList(Long articleId,Integer pageNum,Integer pageSize){

		return commentService.commentList(SystemConstants.ARTICLE_COMMENT,articleId,pageNum,pageSize);

	}

	/**文章评论
	 *
	 * @param comment
	 * @return
	 */
	@PostMapping
	public ResponseResult addComment(@RequestBody Comment comment){
		return commentService.addComment(comment);
	}


	@GetMapping("/linkCommentList")
	public ResponseResult linkCommentList(Integer pageNum,Integer pageSize){

		return commentService.commentList(SystemConstants.LINK_COMMENT,null,pageNum,pageSize);
	}


}
